//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace WorkflowApplication
{
    using System;
    using System.Windows;
    using Microsoft.Research.ScientificWorkflow.UIDesigner;

    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        /// <summary>
        /// Application Entry Point.
        /// </summary>
        [System.STAThreadAttribute()]
        public static void Main()
        {
            SplashScreen splashScreen = new SplashScreen(@"Images\wfapp.png");
            splashScreen.Show(false);

            App app = new App();
            app.InitializeComponent();
            splashScreen.Close(TimeSpan.FromSeconds(1));
            app.Run();
        }

        /// <summary>
        /// Called when application startup.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.StartupEventArgs"/> instance containing the event data.</param>
        private void OnApplicationStartup(object sender, StartupEventArgs e)
        {
            if (e.Args.Length > 0)
            {
                string openedWflFile = e.Args[0];
                if (!string.IsNullOrEmpty(openedWflFile))
                {
                    this.Properties.Add(WflFileHelper.WflFilePath, openedWflFile);
                }
            }
        }
    }
}
